package com.none.web.service.bookParam.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.simple.ParameterizedBeanPropertyRowMapper;
import org.springframework.stereotype.Service;

import com.none.core.service.BaseServiceSupport;
import com.none.web.model.TBookparam;
import com.none.web.service.bookParam.IBookparamService;


@Service("bookParamService")
public class BookparamServiceImpl extends BaseServiceSupport implements IBookparamService {

	@Autowired
    JdbcTemplate jdbcTemplate;
	
	
	@Override
	public TBookparam getParamByKey(String paramKey) {
		TBookparam param =new TBookparam();
		String sql="select * from rgt_bookparam where param_key='"+paramKey+"'";
		RowMapper<TBookparam> sr=ParameterizedBeanPropertyRowMapper.newInstance(TBookparam.class); 
		List<TBookparam> list=this.jdbcTemplate.query(sql,sr);
		param=list.get(0);
		return param;
	}


	@Override
	public List<TBookparam> getAllParam() {
		String sql="select * from rgt_bookparam";
		RowMapper<TBookparam> sr=ParameterizedBeanPropertyRowMapper.newInstance(TBookparam.class); 
		List<TBookparam> list=this.jdbcTemplate.query(sql,sr);
		return list;
	}

}
